<?php

/**
 * This is the model class for table "{{ord_invoice}}".
 *
 * The followings are the available columns in table '{{ord_invoice}}':
 * @property string $zo_id
 * @property integer $zol_type
 * @property string $zol_title
 * @property string $zol_content
 * @property string $zol_code
 * @property string $zol_address
 * @property string $zol_tel
 * @property string $zol_bank
 * @property string $zol_bankcode
 * @property integer $zol_status
 * @property integer $uodatatime
 */
class OrdInvoice extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return OrdInvoice the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{ord_invoice}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('zo_id, zol_title, zol_code', 'required'),
			array('zol_type, zol_status, uodatatime', 'numerical', 'integerOnly'=>true),
			array('zo_id, zol_address, zol_tel, zol_bankcode', 'length', 'max'=>20),
			array('zol_title, zol_content', 'length', 'max'=>255),
			array('zol_code, zol_bank', 'length', 'max'=>50),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('zo_id, zol_type, zol_title, zol_content, zol_code, zol_address, zol_tel, zol_bank, zol_bankcode, zol_status, uodatatime', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'zo_id' => 'Zo',
			'zol_type' => 'Zol Type',
			'zol_title' => 'Zol Title',
			'zol_content' => 'Zol Content',
			'zol_code' => 'Zol Code',
			'zol_address' => 'Zol Address',
			'zol_tel' => 'Zol Tel',
			'zol_bank' => 'Zol Bank',
			'zol_bankcode' => 'Zol Bankcode',
			'zol_status' => 'Zol Status',
			'uodatatime' => 'Uodatatime',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('zo_id',$this->zo_id,true);
		$criteria->compare('zol_type',$this->zol_type);
		$criteria->compare('zol_title',$this->zol_title,true);
		$criteria->compare('zol_content',$this->zol_content,true);
		$criteria->compare('zol_code',$this->zol_code,true);
		$criteria->compare('zol_address',$this->zol_address,true);
		$criteria->compare('zol_tel',$this->zol_tel,true);
		$criteria->compare('zol_bank',$this->zol_bank,true);
		$criteria->compare('zol_bankcode',$this->zol_bankcode,true);
		$criteria->compare('zol_status',$this->zol_status);
		$criteria->compare('uodatatime',$this->uodatatime);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}